<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>煤炭管理系统</title>
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/lib/layui/css/layui-theme-custom.css">
    <link rel="stylesheet" href="/static/css/member.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <#include "/base/main-header.ftl">

    <#include "/base/main-left.ftl">
    <div class="layui-body">
        <!-- 内容主体区域  -->
        <div class="site-title">
            <fieldset>
                <legend>
                    <a class="site-title-text">采购执行查询</a>
                </legend>

            </fieldset>
        </div>

        <div  class="table-box">
            <div class="site-text site-block">
                <form action="" class="layui-form">
                    <div class="layui-form-item">
                        <label for="memberName" class="myLable">采购单状态：</label>
                        <div class="layui-input-block">
                            <input type="radio" name="status" value="" title="全部" checked="">
                            <input type="radio" name="status" value="0" title="已下达">
                            <input type="radio" name="status" value="1" title="已提交">
                            <input type="radio" name="status" value="2" title="已发布">
                            <input type="radio" name="status" value="3" title="已报废">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="myLable">采购单号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="billNumber"   autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                             <button id="query-btn" class="layui-btn layui-btn-radius layui-inline">查询</button>
                        </div>
                    </div>
                </form>
            </div>
            <table class="layui-hide" id="queryPE"></table>
        </div>


    </div>
    <#include "/base/main-footer.ftl">
</div>


<script src="/static/lib/layui/layui.js"></script>
<script type="text/html" id="option1">
    {{#  if(d.execStatus === '已下达'){ }}
    <a href="/PE/update/{{d.id}}" class="layui-btn layui-btn-xs">填报</a>
    {{#  } else { }}
    <a href="/PE/view/{{d.id}}" class="layui-btn layui-btn-normal layui-btn-xs">查看</a>
    {{#  } }}
</script>
<script>
    layui.use(['layer', 'form', 'element', 'jquery','table'], function () {
        let layer = layui.layer, form = layui.form, $ = layui.$, table = layui.table;

        let pe = table.render({
            elem: '#queryPE',
            url:'/purchExec/PEList',
            method: 'post',
            contentType: 'application/json',
            cols: [[
                {field:'id',title: '序号', width:100, sort: true}
                ,{field:'billNumber',  title: '单据编号'}
                ,{field:'coalType',  title: '煤种' }
                ,{field:'purchaseNum', title: '采购数量（万吨）'}
                ,{field:'rec1', title: '收到基低位发热量'}
                ,{field:'yunshuMode', title: '运输方式'}
                ,{field:'releaseTime', title: '下达日期'}
                ,{field:'execStatus', title: '订单状态'}
                ,{field:'', title: '操作',templet: '#option1', unresize: true}
            ]],
            page: true,
            parseData: function(res){
                return {
                    "code": res.code,
                    "msg": res.msg,
                    "count": res.data.total,
                    "data": res.data.rows
                };
            }
        })
        $("#query-btn").click(function (ele) {
            pe.reload({
                where:{
                    status: parseInt($("input[name='status']:checked").val()),
                    billNumber:$("input[name='billNumber']").val()
                }
            })
            return false
        })
    });
</script>
</body>
</html>